package com.hancher.gamelife2.matter;


import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.hancher.common.androidutil.LogUtil;
import com.hancher.common.javautil.DateUtil;
import com.hancher.common.javautil.GsonUtil;
import com.hancher.common.rv.BaseVBAdapter;
import com.hancher.gamelife2.databinding.ItemMatterBinding;

public class MatterAdapter extends BaseVBAdapter<ItemMatterBinding, MatterPO> {
    @Override
    protected ItemMatterBinding createViewBinding(LayoutInflater from, ViewGroup viewGroup) {
        return ItemMatterBinding.inflate(from, viewGroup, false);
    }

    @Override
    protected void convertItem(ItemMatterBinding binding, int position, MatterPO item) {
        LogUtil.i("item : " + GsonUtil.obj2JsonStr(item));
        binding.tvMessage.setText(item.getTitle());
        binding.tvTime.setText(DateUtil.stamp2allStr(item.getCreateTime()));
        binding.tvNumFinished.setVisibility(item.getStatus() == 1 ? View.VISIBLE : View.GONE);
        binding.tvNumTodo.setVisibility(item.getStatus() != 1 ? View.VISIBLE : View.GONE);
        binding.tvNumFinished.setText(String.valueOf(position + 1));
        binding.tvNumTodo.setText(String.valueOf(position + 1));
    }
}
